<template>
	<div>
		<div class="font-title" style="margin-top: 40px;">商品列表</div>
		<div>
			<div style="background-color: #f4f5f6;">
				<div class="row" style="background-color: #FFFFFF;padding: 15px 15px 0px 5px; width: 85%;">
					<div class="select" style="margin-top: 0;">
						<div>商品名称</div>
						<div>
							<el-input size="small" class="input1" style="margin-left: 10px;" v-model="searchInfo.goodName"></el-input>
						</div>

					</div>
					<div class="select" style="margin-top: 0;">
						<div>商品ID</div>
						<div>
							<el-input size="small" class="input1" style="margin-left: 10px;" v-model="searchInfo.goodId"></el-input>
						</div>
					</div>
					<div class="select" style="margin-top: 0;">
						<div style="margin-right: 10px;">是否上架</div>
						<div>
							<el-select v-model="searchInfo.goodState" placeholder="请选择">
								<el-option v-for="item in goodStateList" :key="item.value" :label="item.label" :value="item.value">
								</el-option>
							</el-select>
						</div>
					</div>
				</div>
				<div class="row" style="background-color: #FFFFFF;padding: 0px 15px 15px 5px; width: 85%;">

					<div class="select" style="margin-top: 0;">
						<el-button type="primary" size="big" @click="fetchDataFind(1)">查询</el-button>
						<el-button type="primary" size="big" plain @click="clear()">重置</el-button>
						<el-button type="primary" size="big" @click="navToAddNewProduct()">发布商品</el-button>
					</div>

				</div>
			</div>
		</div>
		<!-- 切换 -->

		<el-tabs v-model="activeName" type="border-card" @tab-click="handleClick" style="margin-top: 20px;width: 85%;">
			<!-- 全部商品 -->
			<!-- 	<el-tab-pane label="全部商品">			
       </el-tab-pane> -->

			<!-- 出售中的商品 -->
			<el-tab-pane name="second" label="出售中的商品">
				<el-table tooltip-effect="dark" :data="dtos_list" style="width: 100%;" v-loading="table_loading"
				 element-table_loading-text="加载中" @sort-change='order'>
					<el-table-column label="商品名称" width="300">
						<template scope="scope">
							<div class="row">
								<img :src="scope.row.goodCover" style="width: 80px;height: 80px;margin: 5px;">
								<div style="color: #8A8A8A;">
									<div style="padding: 10px;width: 200px;text-align: left;">{{scope.row.goodName}}</div>
									<div style="padding: 10px;width: 200px;text-align: left;">ID: {{scope.row.goodId}}</div>
								</div>
							</div>
						</template>
					</el-table-column>
					<el-table-column label="价格" style="vertical-align:middle;text-align:center;">
						<template scope="scope" class="row">
							<div style="color: #F72235;">￥{{scope.row.goodPrice}}</div>
						</template>

					</el-table-column>
					<el-table-column prop="sales" label="销量">
					</el-table-column>
					<el-table-column label="创建时间" show-overflow-tooltip>
						<template scope="scope">
							<span>{{scope.row.creTime}}</span>
						</template>
					</el-table-column>
					<el-table-column label="操作">
						<template scope="scope">
							<div>
								<div style="cursor: pointer;" @click="edit(scope.row.goodId)">编辑商品</div>
							</div>
							<!-- <div>
								<div style="cursor: pointer;" @click="deleteProduct(scope.row.goodId)">删除</div>
							</div> -->
							<!-- 	<el-button v-if="(scope.row.goodState == '2')" type="danger" size="small" @click="handleDelete(scope.row,'下架')">下架</el-button>
							<el-button v-else type="warning" size="small" @click="putAway(scope.row.goodId,scope.row.goodState,scope.row.stock)">上架</el-button> -->
							<div v-if="(scope.row.goodState == '2')" style="cursor: pointer;" @click="handleDelete(scope.row,'下架')">立即下架</div>
							<div v-else style="cursor: pointer;" @click="putAway(scope.row.goodId,scope.row.goodState,scope.row.stock)">上架</div>

						</template>
					</el-table-column>
				</el-table>
				<el-pagination class="fenye" background @current-change="handleCurrentChange" :current-page.sync="pageInfo.pageNum"
				 :page-size="pageInfo.pageSize" layout="total, prev, pager, next" :total="pageInfo.count">
				</el-pagination>
			</el-tab-pane>
			<!-- 仓库中商品 -->
			<el-tab-pane name="third" label="仓库中商品">
				<el-table tooltip-effect="dark" :data="pageInfo3.dtos" v-loading="table_loading" element-table_loading-text="加载中"
				 @sort-change='order' style="width: 100%">
					<el-table-column label="商品名称" width="300">
						<template scope="scope">
							<div class="row">
								<img :src="scope.row.goodCover" style="width: 80px;height: 80px;margin: 5px;">
								<div style="color: #8A8A8A;">
									<div style="padding: 10px;width: 200px;text-align: left;">{{scope.row.goodName}}</div>
									<div style="padding: 10px;width: 200px;text-align: left;">ID: {{scope.row.goodId}}</div>
								</div>
							</div>
						</template>
					</el-table-column>
					<el-table-column label="价格" style="vertical-align:middle;text-align:center;">
						<template scope="scope" class="row">
							<div style="color: #F72235;">￥{{scope.row.goodPrice}}</div>
						</template>

					</el-table-column>
					<el-table-column prop="sales" label="销量">
					</el-table-column>
					<el-table-column label="创建时间" show-overflow-tooltip>
						<template scope="scope">
							<span>{{scope.row.creTime}}</span>
						</template>
					</el-table-column>
					<el-table-column label="操作" width="200">
						<template scope="scope">
							<el-button type="primary" size="small" @click="edit(scope.row.goodId)">编辑</el-button>
							<el-button type="danger" size="small" @click="deleteProduct(scope.row.goodId)">删除</el-button>
							<el-button v-if="(scope.row.goodState == '2')" type="danger" size="small" @click="handleDelete(scope.row,'下架')">下架</el-button>
							<el-button v-else type="warning" size="small" @click="putAway(scope.row.goodId,scope.row.goodState,scope.row.stock)">上架</el-button>
						</template>
					</el-table-column>
				</el-table>
				<el-pagination class="fenye" background @current-change="handleCurrentChange2" :current-page.sync="pageInfo3.pageNum"
				 :page-size="pageInfo3.pageSize" layout="total, prev, pager, next" :total="pageInfo3.count">
				</el-pagination>
			</el-tab-pane>
		</el-tabs>

	</div>

</template>
<style>
	.cell {
		/* display: flex; */

	}

	.select {
		display: flex;
		padding: 10px;
		align-items: center;
		justify-content: center;
	}

	.select-font {
		width: 60px;
		font-size: 18;
		margin-right: 10px;
	}

	.input1 {
		width: 250px;
		height: 15px;
	}

	.mar-20 {
		margin: 20px;
	}

	.el-tabs--border-card>.el-tabs__header {
		background-color: #FBF9FE;
	}

	.el-tabs__item {
		font-size: 16px;
	}
</style>
<script>
	function deepClone(val) {
		if (typeof val === 'undefined') {
			return;
		}
		var temp = JSON.stringify(val);
		return JSON.parse(temp);
	}

	export default {
		data() {
			return {
				fenlei: [],
				shanchu: true,
				price_max: '',
				price_min: '',
				goods_id: '',
				activeName: 'second',
				options: [{
					value: 'zhinan',
					label: '指南',
					children: [{
						value: 'shejiyuanze',
						label: '设计原则',
					}]
				}],
				title: '用户列表',
				table_loading: false,
				table_loading2: false,
				typeStatus: 'first',
				formInline: {
					goodIdent: '2',
					goodId: '',
					goodName: '',
					goodOneCate: '',
					goodTwoCate: '',
					goodState: '2',
					storeId: '',
					pageNum: 1,
					pageSize: 10,
					sort: 'T1.CRE_TIME',
					desc: 'DESC',
					goodIsDiscount: ''
				},
				pageInfo: {
					pageNum: 1,
					pageSize: 10,
					count: 1,
					dtos: []
				},
				dtos_list: [],
				pageInfo2: {
					pageNum: 1,
					pageSize: 5,
					count: 1,
					dtos: []
				},
				formLabelWidth: '120px',
				sortList: [],
				secondList: [],
				showSort: false,
				storeId: '',
				dialogVisible: false,
				id: '',
				img: {
					is_preview: false,
					preview_url: '',
					image_index: null,
					preview_images: [],
					transform: ''
				},
				//仓库中
				table_loading3: false,
				formInline3: {
					goodIdent: '2',
					goodsName: '',
					goodOneCate: '',
					goodTwoCate: '',
					goodState: '',
					storeId: '',
					pageNum: 1,
					pageSize: 10,
					sort: 'T1.CRE_TIME',
					desc: 'DESC',
					goodIsDiscount: ''
				},
				pageInfo3: {
					pageNum: 1,
					pageSize: 10,
					count: 1,
					dtos: []
				},
				gridData: [],
				checked: [],
				checkAll: false,
				isIndeterminate: true,
				arr: [],
				sortList3: [],
				secondList3: [],
				loading: false,
				flag2: '',
				showSort3: false,
				storeId3: '',
				goodStateList: [{
					value: '2',
					label: '上架'
				}, {
					value: '3',
					label: '下架'
				}],
				searchInfo: {
					goodId: '',
					goodName: '',
					goodOneCate: '',
					goodTwoCate: '',
					goodState: '',
					storeId: '',
					pageNum: 1,
					pageSize: 10,
					sort: 'T1.CRE_TIME',
					desc: 'DESC',
					goodIsDiscount: '',
					goodIdent: '2',
				}
			}
		},
		created() {
			// this.searchInfo = {
			// 	goodId: '',
			// 	goodName: '',
			// 	goodOneCate: '',
			// 	goodTwoCate: '',
			// 	goodState: '',
			// 	storeId: '',
			// 	pageNum: 1,
			// 	pageSize: 10,
			// 	sort: 'T1.CRE_TIME',
			// 	desc: 'DESC',
			// 	goodIsDiscount: ''
			// }
			// this.formInline ={
			// 	goodId: '',
			// 	goodName: '',
			// 	goodOneCate: '',
			// 	goodTwoCate: '',
			// 	goodState: '2',
			// 	storeId: '',
			// 	pageNum: 1,
			// 	pageSize: 10,
			// 	sort: 'T1.CRE_TIME',
			// 	desc: 'DESC',
			// 	goodIsDiscount: ''
			// }
			// this.formInline3 ={
			// 	goodId: '',
			// 	goodName: '',
			// 	goodOneCate: '',
			// 	goodTwoCate: '',
			// 	goodState: '',
			// 	storeId: '',
			// 	pageNum: 1,
			// 	pageSize: 10,
			// 	sort: 'T1.CRE_TIME',
			// 	desc: 'DESC',
			// 	goodIsDiscount: ''
			// }
			this.fetchData(this.pageInfo.pageNum);
			this.selectSort()
			this.fetchData3(this.pageInfo3.pageNum);
			this.selectSort_1()
		},
		watch: {
			// 'formInline.name'(val, oldVal) {
			// 	//console.log(val)
			// 	this.formInline[this.formInline.type] = this.formInline.name
			// }
		},
		methods: {
			// 商品列表
			fetchData(page = 1) {
				this.table_loading = true;
				this.pageInfo.pageNum = page
				this.formInline.pageNum = this.pageInfo.pageNum
				console.log(this.formInline, '商品列表参数')
				this.dataApi.ajax('selectPageStoreGood', this.formInline, res => {
					this.table_loading = false;
					if (res.responseType === 'S') {
						//更多按钮里面显示隐藏	

						var dtos_list = res.dtos
						this.pageInfo.pageNum = res.pageNum
						this.pageInfo.pageSize = res.pageSize
						this.pageInfo.count = res.count

						dtos_list.forEach(item => {
							item.checked = false
						})
						this.dtos_list = dtos_list
						// console.log(this.dtos_list, '接口列表')
					}
				});


			},
			/**
			 * 方法说明
			 * author: liuchen
			 * description: 商品列表tab切换
			 * @param 
			 * @return 
			 * @createTime: 2020/7/13
			 */
			handleClick(tab, event) {
				this.typeStatus = tab.name
				if (tab.name == 'first') {
					this.table_loading = true;
					this.pageInfo.pageNum = 1
					this.formInline.pageNum = this.pageInfo.pageNum
					var data = this.formInline
					data.goodState = ''
					// console.log(data, '商品查询')
					// return
					this.dataApi.ajax('selectPageStoreGood', data, res => {
						this.table_loading = false;
						if (res.responseType === 'S') {
							//更多按钮里面显示隐藏	
							var dtos_list = res.dtos
							this.pageInfo.pageNum = res.pageNum
							this.pageInfo.pageSize = res.pageSize
							this.pageInfo.count = res.count
							dtos_list.forEach(item => {
								item.checked = false
							})
							this.dtos_list = dtos_list
							// console.log(this.dtos_list, '接口列表')
						}
					});
				}
				//				出售
				if (tab.name == 'second') {
					this.formInline = {
						goodId: '',
						goodName: '',
						goodOneCate: '',
						goodTwoCate: '',
						goodState: '2',
						storeId: '',
						pageNum: 1,
						pageSize: 10,
						sort: 'T1.CRE_TIME',
						desc: 'DESC',
						goodIsDiscount: '',
						goodIdent: '2',
					}
					this.fetchData(1)
				}
				// 仓库
				if (tab.name == 'third') {
					this.formInline3 = {
						goodsName: '',
						goodOneCate: '',
						goodTwoCate: '',
						goodState: '',
						storeId: '',
						pageNum: 1,
						pageSize: 10,
						sort: 'T1.CRE_TIME',
						desc: 'DESC',
						goodIsDiscount: '',
						goodIdent: '2',
					}
					this.fetchData3(1)
				}
				// console.log(tab.name, event);
			},
			// 查询
			fetchDataFind(page = 1) {
				this.table_loading = true;
				this.pageInfo.pageNum = page
				this.searchInfo.pageNum = this.pageInfo.pageNum

				var data = this.searchInfo
				// console.log(data, '商品查询')
				this.dataApi.ajax('selectPageStoreGood', data, res => {
					this.table_loading = false;
					if (res.responseType === 'S') {
						//更多按钮里面显示隐藏	
						if (this.activeName == 'second') {
							this.formInline = this.searchInfo
							var dtos_list = res.dtos
							this.pageInfo.pageNum = res.pageNum
							this.pageInfo.pageSize = res.pageSize
							this.pageInfo.count = res.count

							dtos_list.forEach(item => {
								item.checked = false
							})
							this.dtos_list = dtos_list
						}
						if (this.activeName == 'third') {
							this.formInline3 = this.searchInfo
							var dtos_list = res.dtos
							this.pageInfo3.pageNum = res.pageNum
							this.pageInfo3.pageSize = res.pageSize
							this.pageInfo3.count = res.count

							dtos_list.forEach(item => {
								item.checked = false
							})
							this.pageInfo3.dtos = dtos_list
						}
						// console.log(this.dtos_list, '接口列表')
					}
				});


			},
			// 仓库中
			fetchData3(page = 1) {
				this.table_loading = true;
				this.pageInfo3.pageNum = page
				this.formInline3.pageNum = page
				this.dataApi.ajax('selectPageStoreGood', this.formInline3, res => {
					this.table_loading = false;
					if (res.responseType === 'S') {
						this.pageInfo3 = res
						this.gridData = []
						for (var i = res.dtos.length - 1; i >= 0; i--) {
							if (res.dtos[i].goodState != 6) {
								this.gridData.push(res.dtos[i])
							}
						}
						this.arr = []
						for (var i = this.gridData.length - 1; i >= 0; i--) {
							this.arr.push(this.gridData[i].goodId)
						}
						if (this.checked.length == this.arr.length) {
							this.checkAll = true
						} else {
							this.checkAll = false;
						}
					}
				});


			},
			fetchList() {
				this.dataApi.ajax('MallGoodClassifyControl/selectListOne', null, res => {
					if (res.responseType === 0) {
						this.sortList3 = res.goodsClassifyPojos
					}
				});
			},
			changeType(e) {
				this.formInline3.supplierName = ''
				this.formInline3.goodsName = ''
			},

			edit(id) {
				this.$router.push('/mall/edit_take_out_good/' + id)
			},
			deleteProduct(id) {
				this.loading = true
				this.$confirm('确定删除?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					var list = []
					list.push(id)
					this.loading = true
					this.dataApi.ajax('batchDeleteGoodStat', {
						goodIdList: list
					}, res => {
						if (res.responseType === 'S') {
							this.loading = false
							this.showMsg('删除')
							this.fetchData3(this.pageInfo3.pageNum)
						}
					});
				}).catch(() => {
				
				});
				console.log(id, '删除')
			},
			handleCheckedCitiesChange(value) {
				let arr = []
				for (var i = this.arr.length - 1; i >= 0; i--) {
					for (var j = this.checked.length - 1; j >= 0; j--) {
						if (arr.indexOf(this.checked[j] === -1) && this.arr[i] === this.checked[j]) {
							arr.push(this.checked[j])
						}
					}
				}
				let checkedCount = arr.length;
				this.checkAll = checkedCount === this.arr.length;
				this.isIndeterminate = checkedCount > 0 && checkedCount < this.arr.length;
			},
			handleCheckAllChange(event) {
				// console.log(this.checked)
				if (event.target.checked == false) {
					for (var i = this.arr.length - 1; i >= 0; i--) {
						for (var j = this.checked.length - 1; j >= 0; j--) {
							if (this.arr.indexOf(this.checked[j]) !== -1) {
								this.checked.splice(j, 1)
							}
						}
					}

				} else {
					this.isIndeterminate = false;
					for (var i = this.gridData.length - 1; i >= 0; i--) {
						if (this.checked.indexOf(this.arr[i]) === -1) {
							this.checked.push(this.arr[i])

						}

					}
				}


			},
			putAway(id, state, num) {
				if (state == 6) {
					this.showMsg('此商品包含敏感信息,官方平台已下架,请联系平台客服,进行上架操作', 'warning')
					return
				}
				this.$confirm('确定上架?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					var list = []
					if (id) {
						list.push(id)
					} else {
						if (this.checked.length == 0) {
							this.showMsg('请选择要上架的商品', 'warning')
							return
						}
						list = this.checked
					}
					this.loading = true
					this.dataApi.ajax('batchUpdateGoodStat', {
						goodIdList: list
					}, res => {
						if (res.responseType === 'S') {
							this.loading = false
							this.showMsg('上架成功')
							this.fetchData3(this.pageInfo3.pageNum)
						}
					});
				}).catch(() => {

				});
			},
			selectSort_1() {
				this.dataApi.ajax('selectGoodCate', {
					cateState: '1'
				}, res => {
					//console.log(res)
					if (res.responseType === 'S') {
						this.sortList3 = res.dtos
					}
				});

			},
			selectSort2() {
				this.formInline3.goodTwoCate = ''
				this.dataApi.ajax('selectGoodCate', {
					cateId: this.formInline3.goodOneCate,
					cateState: '1'
				}, res => {
					//console.log(res)
					if (res.responseType === 'S') {
						this.secondList3 = res.dtos
					}
				});

			},
			setOldProbability(item) {
				item.OldProbability = item.roomSort
			},
			// editOrder(item){
			//      if (Math.floor(item.roomSort) <= 0) {
			//         item.roomSort = item.OldProbability || 0;
			//         return false;
			//     }
			//     if (item.OldProbability == item.roomSort) return false;
			//     if (!isNumber(item.roomSort)) {
			//        this.showMsg('只能输入数字','warning')
			//        item.roomSort=item.OldProbability
			//        return false;
			//     }
			//      this.dataApi.ajax('editStoreGood',{
			//          storeGoodDto:{
			//            goodId:item.goodId,
			//            roomSort:item.roomSort
			//          }
			//      }, res => {
			//         if (res.responseType === 'S') {
			//             this.showMsg('修改成功')
			//             this.fetchData3(this.pageInfo3.pageNum)
			//         }
			//     });
			// },
			// handleDelete(id){
			//     this.$confirm('确认删除?', '提示', {
			//           confirmButtonText: '确定',
			//           cancelButtonText: '取消',
			//           type: 'warning'
			//         }).then(() => {
			//           this.dataApi.ajax('MallGoodListControl/deleteGoodsList',{goodslistId:id}, res => {
			//                 if (res.responseType === 0) {
			//                     this.$message({
			//                       type: 'success',
			//                       message: '删除成功!'
			//                     });
			//                     this.fetchData3(this.pageInfo3.pageNo)
			//                 }
			//             });
			//         }).catch(() => {

			//         });
			// },
			// order(column){
			//      if (!column.order) {
			//          return;
			//      }
			//      if (column.order=='ascending') {
			//           this.formInline3.desc='ASC'
			//      }else{
			//          this.formInline3.desc='DESC'
			//      }
			//      this.formInline3.sort=column.prop.toUpperCase()
			//      this.fetchData3(this.pageInfo3.pageNum)
			//  },


			// 
			//清空
			clear() {

				this.searchInfo = {
					goodId: '',
					goodsName: '',
					goodOneCate: '',
					goodTwoCate: '',
					goodState: '',
					storeId: '',
					pageNum: 1,
					pageSize: 10,
					sort: 'T1.CRE_TIME',
					desc: 'DESC',
					goodIsDiscount: ''
				}
				this.formInline3 = {
						goodsName: '',
						goodOneCate: '',
						goodTwoCate: '',
						goodState: '',
						storeId: '',
						pageNum: 1,
						pageSize: 10,
						sort: 'T1.CRE_TIME',
						desc: 'DESC',
						goodIsDiscount: ''
					},
					this.formInline = {
						goodsName: '',
						goodOneCate: '',
						goodTwoCate: '',
						goodState: '2',
						storeId: '',
						pageNum: 1,
						pageSize: 10,
						sort: 'T1.CRE_TIME',
						desc: 'DESC',
						goodIsDiscount: ''
					},
					this.fetchData(1);
				this.fetchData3(1)
				// this.formInline.goodName='';
				// this.formInline.goodId='';
				// this.formInline.goodOneCate='';
				// this.formInline.goodTwoCate='';
				// // this.price_min='';
				// // this.price_max='';
				// this.formInline.goodIsDiscount='';
			},
			navToAddNewProduct() {
				/**
				 * 方法说明
				 * author: liuchen
				 * description: 
				 * @param 前往发布商品
				 * @return 
				 * @createTime: 2020/7/13
				 */
				this.$router.push('/mall/new_take_out_good/0')
			},
			// 选择分类
			handleChange(value) {
				// console.log(value);
			},
			genduo(id) {
				this.pageInfo.dtos.forEach(item => {
					if (item.goodId = id) {
						item.checked = true
					}

				})
				this.shanchu = !this.shanchu
			},




			handleCurrentChange(val) {
				console.log(this.searchInfo)
				this.fetchData(val)
			},
			handleCurrentChange2(val) {

				this.fetchData3(val)
			},

			// setOldProbability(item) {
			// 	item.OldProbability = item.roomSort
			// },
			editOrder(item) {
				if (Math.floor(item.roomSort) <= 0) {
					item.roomSort = item.OldProbability || 0;
					return false;
				}
				if (item.OldProbability == item.roomSort) return false;
				if (!isNumber(item.roomSort)) {
					this.showMsg('只能输入数字', 'warning')
					item.roomSort = item.OldProbability
					return false;
				}
				this.dataApi.ajax('editStoreGood', {
					storeGoodDto: {
						goodId: item.goodId,
						roomSort: item.roomSort
					}
				}, res => {
					if (res.responseType === 'S') {
						this.showMsg('修改成功')
						this.fetchData(this.pageInfo.pageNum)
					}
				});
			},
			handleDelete(item, type) {
				var state = ''
				if (item.goodState == 2) {
					state = 3
				} else {
					state = 2
				}

				this.$confirm('确认' + type + '?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.dataApi.ajax('editStoreGood', {
						storeGoodDto: {
							goodId: item.goodId,
							goodState: state
						}
					}, res => {
						if (res.responseType === 'S') {
							this.showMsg(type + '成功!')
							this.fetchData(this.pageInfo.pageNum)
						}
					});
				}).catch(() => {

				});
			},
			order(column) {
				if (!column.order) {
					return;
				}
				if (column.order == 'ascending') {
					this.formInline.desc = 'ASC'
				} else {
					this.formInline.desc = 'DESC'
				}
				this.formInline.sort = column.prop.toUpperCase()
				this.fetchData(this.pageInfo.pageNum)
			},
			// add() {
			// 	sessionStorage.removeItem('addBasic')
			// 	sessionStorage.removeItem('addBasic_s')
			// 	this.$router.push('/mall/add_goods/0')
			// },
			selectSort() {
				this.dataApi.ajax('selectGoodCate', {
					cateState: '1'
				}, res => {

					if (res.responseType === 'S') {
						this.sortList = res.dtos
						// sortList.forEach(item=>{
						// 	item.label=item.cateName
						// 	item.value=item.cateId
						// })
						// this.sortList=sortList
						// console.log(this.sortList,'sortList')

					}
				});

			},
			// selectSort2() {
			// 	this.formInline.goodTwoCate = ''
			// 	this.dataApi.ajax('selectGoodCate', {
			// 		cateId: this.formInline.goodOneCate,
			// 		cateState: '1'
			// 	}, res => {

			// 		//console.log(res)
			// 		if (res.responseType === 'S') {
			// 			this.secondList = res.dtos

			// 		}
			// 	});

			// },
			check(id) {
				this.id = id
				this.fetchData2(1)
				this.dialogVisible = true
			},
			fetchData2(page = 1) {
				this.table_loading2 = true;
				this.pageInfo2.pageNum = page
				this.dataApi.ajax('selectPageShopEvaluat', {
					pageNum: this.pageInfo2.pageNum,
					pageSize: this.pageInfo2.pageSize,
					sort: 'T1.CRE_TIME',
					desc: 'DESC',
					goodId: this.id,
					evaluateType: 1
				}, res => {
					this.table_loading2 = false;
					if (res.responseType === 'S') {
						this.pageInfo2 = res
					}
				});


			},
			previewImage(src) {
				this.img.is_preview = true;
				this.img.preview_url = `url(${src})`;
				this.img.preview_images = this.images;
				this.img.transform = '';
			},
			hidePreview() {
				this.img.is_preview = false;
				this.img.preview_url = null;
				this.img.image_index = null;
				this.img.preview_images = [];
				this.img.transform = '';
			},
			rotate() {
				if (this.img.transform == '') {
					this.img.transform = 'rotate(90deg)'
				} else if (this.img.transform == 'rotate(90deg)') {
					this.img.transform = 'rotate(180deg)'
				} else if (this.img.transform == 'rotate(180deg)') {
					this.img.transform = 'rotate(270deg)'
				} else if (this.img.transform == 'rotate(270deg)') {
					this.img.transform = ''
				}
			}

		}
	}
</script>
